package 第14届;
import java.io.*;
import java.util.*;
public class D_矩形总面积 {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int x1,y1,x2,y2,x3,y3,x4,y4;
		// 矩形1 左下角
		x1 = Integer.parseInt(st.nextToken());
		y1 = Integer.parseInt(st.nextToken());
		// 矩形1 右上角
		x2 = Integer.parseInt(st.nextToken());
		y2 = Integer.parseInt(st.nextToken());
		// 矩形2 左下角
		x3 = Integer.parseInt(st.nextToken());
		y3 = Integer.parseInt(st.nextToken());
		// 矩形2 右上角
		x4 = Integer.parseInt(st.nextToken());
		y4 = Integer.parseInt(st.nextToken());
//		System.out.println(x1 + " " + y1 + " " + x2 + " " + y2 + " " + x3 + " " + y3 + " " + x4 + " " + y4);
		int temp;
		// 矩形二的左下角比矩形一的还小，则把数值互换
		if(x3 < x1) {
			temp = x1;
			x1 = x3;
			x3 = temp;
			
			temp = y1;
			y1 = y3;
			y3 = temp;
			
			temp = x2;
			x2 = x4;
			x4 = temp;
			
			temp = y2;
			y2 = y4;
			y4 = temp;
		}
		// 矩形一二的面积和
		int area = (x2 - x1) * (y2 - y1) + (x4 - x3) * (y4 - y3);
		int removeArea = 0;
		// 没有重叠
		if(x2 < x3 || y2 < y3) {
			System.out.println(area);
		} else { // 有重叠
			// 矩形二在矩形一内，只算矩形一
			if(x3 >= x1 && y3 >= x1 && x4 <= x2 && y4 <= y2) {
				area = (x2 - x1) * (y2 - y1);
				System.out.println(area);
			} else {
				// 矩形二不在矩形一内，但是有重叠部分
				removeArea = (x2 - x3) * (Math.max(y2, y4) - Math.min(y2, y4));
				area -= removeArea;
				System.out.println(area);
			}
		}
		
		
		
	}
}
